package day08;

import java.util.Comparator;
import java.util.TreeSet;

public class test03 {
    public static void main(String[] args) {
        TreeSet<Double> list = new TreeSet<>(
                new Comparator<Double>() {
                    @Override
                    public int compare(Double o1, Double o2) {
                        double v = (o2 - o1);
                        if (v == 0.0) {
                            v = 1;

                        }
                        if (v < 0) {
                            v = -1;

                        }
                        return  (int) v;
                    }
                });
        list.add(1.1);
        list.add(5.2);
        list.add(6.3);
        list.add(2.5);
        list.add(5.2);
        list.add(3.3);
        for (Double a : list) {
            System.out.println(a);
        }

    }
}
